<?php

namespace app\admin\validate\supplier;

use think\Validate;

class Mobile extends Validate
{
    protected $rule = [
        'name' => 'require|max:30',
        // 'discount_slow' => 'require|regex:\d{2,3}([.]{1}[0-9]{1,2})?|egt:90|elt:130',
        // 'discount_fast' => 'require|regex:\d{2,3}([.]{1}[0-9]{1,2})?|egt:90|elt:130',

        'discount_slow_all.1' => 'require|regex:\d{2,3}([.]{1}[0-9]{1,2})?|egt:90|elt:130',
        'discount_slow_all.2' => 'require|regex:\d{2,3}([.]{1}[0-9]{1,2})?|egt:90|elt:130',
        'discount_slow_all.3' => 'require|regex:\d{2,3}([.]{1}[0-9]{1,2})?|egt:90|elt:130',
        'discount_fast_all.1' => 'require|regex:\d{2,3}([.]{1}[0-9]{1,2})?|egt:90|elt:130',
        'discount_fast_all.2' => 'require|regex:\d{2,3}([.]{1}[0-9]{1,2})?|egt:90|elt:130',
        'discount_fast_all.3' => 'require|regex:\d{2,3}([.]{1}[0-9]{1,2})?|egt:90|elt:130',

        'priority_slow' => 'require|egt:0',
        'priority_fast' => 'require|egt:0',
        'code' => 'require|max:30',
        'url' => 'require|max:100',
        'app_id' => 'require|max:50',
        'app_secret' => 'require|max:130',
    ];

    protected $message = [
        'name.require' => '请输入名称',
        'name.max' => '名称不能超过 30 个字符',

        // 'discount_slow.require' => '请输入慢充折扣',
        // 'discount_slow.regex' => '慢充折扣范围：90.00 ~ 130.00',
        // 'discount_slow.egt' => '慢充折扣范围：90.00 ~ 130.00',
        // 'discount_slow.elt' => '慢充折扣范围：90.00 ~ 130.00',
        // 'discount_fast.require' => '请输入快充折扣',
        // 'discount_fast.regex' => '快充折扣范围：90.00 ~ 130.00',
        // 'discount_fast.egt' => '快充折扣范围：90.00 ~ 130.00',
        // 'discount_fast.elt' => '快充折扣范围：90.00 ~ 130.00',

        // 折扣区分运营商
        'discount_slow_all.1.require' => '请输入移动慢充折扣',
        'discount_slow_all.1.regex' => '移动慢充折扣范围：90.00 ~ 130.00',
        'discount_slow_all.1.egt' => '移动慢充折扣范围：90.00 ~ 130.00',
        'discount_slow_all.1.elt' => '移动慢充折扣范围：90.00 ~ 130.00',
        'discount_fast_all.1.require' => '请输入移动快充折扣',
        'discount_fast_all.1.regex' => '移动快充折扣范围：90.00 ~ 130.00',
        'discount_fast_all.1.egt' => '移动快充折扣范围：90.00 ~ 130.00',
        'discount_fast_all.1.elt' => '移动快充折扣范围：90.00 ~ 130.00',

        'discount_slow_all.2.require' => '请输入联通慢充折扣',
        'discount_slow_all.2.regex' => '联通慢充折扣范围：90.00 ~ 130.00',
        'discount_slow_all.2.egt' => '联通慢充折扣范围：90.00 ~ 130.00',
        'discount_slow_all.2.elt' => '联通慢充折扣范围：90.00 ~ 130.00',
        'discount_fast_all.2.require' => '请输入联通快充折扣',
        'discount_fast_all.2.regex' => '联通快充折扣范围：90.00 ~ 130.00',
        'discount_fast_all.2.egt' => '联通快充折扣范围：90.00 ~ 130.00',
        'discount_fast_all.2.elt' => '联通快充折扣范围：90.00 ~ 130.00',

        'discount_slow_all.3.require' => '请输入电信慢充折扣',
        'discount_slow_all.3.regex' => '电信慢充折扣范围：90.00 ~ 130.00',
        'discount_slow_all.3.egt' => '电信慢充折扣范围：90.00 ~ 130.00',
        'discount_slow_all.3.elt' => '电信慢充折扣范围：90.00 ~ 130.00',
        'discount_fast_all.3.require' => '请输入电信快充折扣',
        'discount_fast_all.3.regex' => '电信快充折扣范围：90.00 ~ 130.00',
        'discount_fast_all.3.egt' => '电信快充折扣范围：90.00 ~ 130.00',
        'discount_fast_all.3.elt' => '电信快充折扣范围：90.00 ~ 130.00',

        'code.require' => '请输入代号',
        'code.max' => '代号不能超过 30 个字符',
        'url.require' => '请输入接口地址',
        'url.max' => '接口地址不能超过 100 个字符',
        'app_id.require' => '请输入 AppID',
        'app_id.max' => 'AppID 不能超过 50 个字符',
        'app_secret.require' => '请输入 AppSecret',
        'app_secret.max' => 'AppSecret 不能超过 130 个字符',
        'priority_slow.require' => '请填写慢充通道优先级',
        'priority_slow.egt' => '慢充通道优先级不能小于 0',
        'priority_fast.require' => '请填写快充通道优先级',
        'priority_fast.egt' => '快充通道优先级不能小于 0',
    ];

    protected $scene = [
        'create' => [
            'name',
            // 'discount_slow',
            // 'discount_fast',

            // 折扣区分运营商
            'discount_slow_all.1',
            'discount_slow_all.2',
            'discount_slow_all.3',
            'discount_fast_all.1',
            'discount_slow_all.2',
            'discount_slow_all.3',

            'priority_slow',
            'priority_fast',
            'code',
            'url',
            'app_id',
            'app_secret',
        ],
        'edit' => [
            'id',
            'name',
            // 'discount_slow',
            // 'discount_fast',

            // 折扣区分运营商
            'discount_slow_all.1',
            'discount_slow_all.2',
            'discount_slow_all.3',
            'discount_fast_all.1',
            'discount_slow_all.2',
            'discount_slow_all.3',

            'priority_slow',
            'priority_fast',
            'code',
            'url',
            'app_id',
            'app_secret',
        ],
        'balance' => [
            'id',
        ]
    ];
}
